package cn.kgc.service.impl;

import cn.kgc.bean.pojo.CRole;
import cn.kgc.mapper.RoleManagerMapper;
import cn.kgc.service.RoleManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleManagerServiceImpl implements RoleManagerService {
    @Autowired
    private RoleManagerMapper rmm;
    @Override
    public List<CRole> selectAll() {
        return rmm.selectAll();
    }

    @Override
    public boolean addRole(CRole cRole) {
        if (rmm.addRole(cRole) > 0){
            return true;
        }
        return false;
    }

    @Override
    public boolean deleteRoleById(long id) {
        if (rmm.deleteRoleById(id) > 0){
            return true;
        }
        return false;
    }

    @Override
    public CRole selectAllById(long id) {
        return rmm.selectAllById(id);
    }

    @Override
    public boolean updateRole(CRole cRole) {
        if (rmm.updateRole(cRole) > 0){
            return true;
        }
        return false;
    }

    @Override
    public List<CRole> selectByName(String name) {
        return rmm.selectByName(name);
    }
}
